package net.aiion.weave.impl.routing;

import net.aiion.weave.spi.naming.annotations.GlobalScoped;
import net.aiion.weave.spi.naming.annotations.Named;
import net.aiion.weave.spi.routing.Route;
import net.aiion.weave.spi.routing.RouteFactory;
import net.aiion.weave.spi.routing.RouteMessage;


@GlobalScoped
@Named
public class RouteFactoryImpl implements RouteFactory
{
    public RouteFactoryImpl() {
    }

    @Override
    public Route createRoute(final String aRouteURI) {
        final RouteBuilder routeBuilder = new RouteBuilder(aRouteURI);
        return routeBuilder.createRoute();
    }

    @Override
    public RouteMessage createRouteMessage(final Route aRoute) {
        return new RouteMessageImpl(aRoute);
    }

    @Override
    public RouteMessage createRouteMessage(final String aRouteURI) {
        return createRouteMessage(createRoute(aRouteURI));
    }
}
